package mud.ssdb;

import org.nutz.ssdb4j.spi.*;
import org.nutz.ssdb4j.*;

public class SSDBHelper {

	final String E_UKN = "暂时不清楚T_T";

	SSDB ssdb;
	Response resp;
	String reply;

	public SSDBHelper(String host, int port) {
		ssdb = SSDBs.simple(host, port, 2000);
	}

	public boolean set(String key, String value) {
		resp = ssdb.set(key, value);
		if (!resp.ok())
			return false;
		else
			return true;
	}

	public String get(String key) {
		resp = ssdb.get(key);
		if (!resp.ok())
			reply = E_UKN;
		else
			reply = resp.asString();
		return reply;
	}
	

	public boolean del(String key){
		resp=ssdb.del(key);
		if (!resp.ok())
			return false;
		else
			return true;
	}
}
